<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
    var huangshihan = new Teacher('黄诗涵', 27, 111);
    var wangjingkai = new Teacher('王靖凯', 25, 111);
    console.log(huangshihan);
    wangjingkai.showId();

    //构造函数  /  类
    function Teacher(name, age, id) {
        this.name = name;
        this.age = age;
        this.id = id;
        this.showId = function() {
            alert(this.id);
        };
    }

    </script>
</body>
</html>